

import os
import sys
import subprocess
import json


if len(sys.argv) != 2:
    print("python download.py package")
    sys.exit(-1)

ret = subprocess.run('conan info '+sys.argv[1]+'@ -r=conan-center -j=o.json')
if ret.returncode != 0:
    print("error!")
    sys.exit(ret.returncode)

# parse json file 
fj = open('o.json',)
jdata = json.load(fj)
print(json.dumps(jdata, indent=4))

for ref in jdata:
    print(ref["reference"])
sys.exit(0)
